﻿using SheepStorage.Domain.Entity;
using SheepStorage.Repository.Interface;
using SheepStorage.Service.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SheepStorage.Service.DataImp
{
    /// <summary>
    /// 区域服务实现
    /// </summary>
    public class AreaService : IAreaService
    {
        /// <summary>
        /// 区域仓储
        /// </summary>

        private readonly IBaseRepository<Area> repository;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="repository">区域仓储</param>
        public AreaService(IBaseRepository<Area> repository)
        {
            this.repository = repository;
        }



        /// <summary>
        /// 显示所有区域信息
        /// </summary>
        /// <param name="ProvinceId"></param>
        /// <returns></returns>
        public async Task<List<Area>> GetArea(int ProvinceId)
        {
            var list= repository.GetAll().ToList();

                list=list.Where(c=>c.ProvinceId==ProvinceId).ToList();  
            
            return list;    
        }
    }
}
